<?php


namespace app\services\delivery;


use app\models\delivery\GoodsModel;
use app\services\BaseService;

class GoodsService extends BaseService
{

    protected static function initModel()
    {
        return new GoodsModel();
    }

    /**
     * 获取商品列表
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getGoodsList()
    {
        $list = self::initModel()->select()->toArray();
        return $list;
    }

    public static function getGoodsName($goodsId)
    {
        $goodsName = self::initModel()->where('id', $goodsId)->value('goods_name');
        return $goodsName;
    }
}